package com.stone.back.dish.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.stone.back.dish.dao.IWeekMenuDao;
import com.stone.back.dish.entity.BfWeekmenu;
import com.stone.back.dish.entity.BfWeekmenuCombo;
import com.stone.base.entity.Page;

/**
 * 周菜单管理
 * @author Stone P
 *
 */
@Service
public class WeekMenuService implements IWeekMenuService {
	@Autowired
	private IWeekMenuDao weekMenuDao;

	/**
	 * 查询周菜单分页信息
	 * @param pageNumber	页数
	 * @param startDate		销售日期
	 * @param endDate		销售日期
	 * @return
	 */
	@Override
	public Page selectWeekMenuPage(int pageNumber, String startDate, String endDate) {
		return weekMenuDao.selectWeekMenuPage(pageNumber, startDate, endDate);
	}

	/**
	 * 增加周菜单
	 * @param weekMenu	周菜单信息
	 * @return
	 */
	@Override
	public Integer addWeekMenu(BfWeekmenu weekMenu) {
		Integer weekMenuId = this.weekMenuDao.addWeekMenu(weekMenu);
		return weekMenuId;
	}

	/**
	 * 周菜单和套餐关系
	 * @param weekmenuCombo	周菜单套餐信息
	 * @return
	 */
	@Override
	public Integer addWeekMenuCombo(BfWeekmenuCombo weekmenuCombo) {
		Integer comboDishId = this.weekMenuDao.addWeekMenuCombo(weekmenuCombo);
		return comboDishId;
	}

	/**
	 * 修改周菜单
	 * @param weekMenu	周菜单信息
	 * @return
	 */
	@Override
	public void updateWeekMenu(BfWeekmenu weekMenu) {
		this.weekMenuDao.updateWeekMenu(weekMenu);
	}

	/**
	 * 周菜单和套餐关系
	 * @param comboDish	周菜单套餐信息
	 * @return
	 */
	@Override
	public void deleteWeekMenuDish(int weekMenuId) {
		this.weekMenuDao.deleteWeekMenuDish(weekMenuId);
	}

	/**
	 * 查询周菜单详情
	 * @param weekMenuId	周菜单Id
	 * @return
	 */
	@Override
	public BfWeekmenu selectWeekMenuDetail(int weekMenuId) {
		BfWeekmenu weekMenu = this.weekMenuDao.selectWeekMenuDetail(weekMenuId);
		return weekMenu;
	}

	/**
	 * 查询周菜单和套餐关系详情
	 * @param weekMenuId	周菜单Id
	 * @return
	 */
	@Override                    
	public List<BfWeekmenuCombo> selectWeekMenuComboDetail(int weekMenuId) {
		List<BfWeekmenuCombo> comboDishList = this.weekMenuDao.selectWeekMenuComboDetail(weekMenuId);
		return comboDishList;
	}

	/**
	 * 删除周菜单
	 * @param weekMenuId	周菜单Id
	 * @return
	 */
	@Override
	public void deleteWeekMenu(int weekMenuId) {
		BfWeekmenu weekMenu = this.weekMenuDao.selectWeekMenuDetail(weekMenuId);
		weekMenuDao.deleteWeekMenu(weekMenu);
	}
}
